﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.utils {
    import reprise.ui.*;
    import flash.events.*;
    import reprise.events.*;
    import flash.display.*;
    import reprise.controls.LabelButton;
	import reprise.controls.AbstractButton;
	import reprise.controls.BitmapElement;
	import reprise.controls.Label;
	import reprise.controls.RadioButton;
	import reprise.controls.RadioButtonGroup;
	import reprise.controls.Scrollbar;
	import reprise.controls.TextInput;
	import flash.utils.*;
    import net.wooga.pets.views.components.*;

    public class RepriseUtils {

        public static function convertAllTagsToCSSClasses(_arg1:String):String{
            return (convertStandardToReprise(_arg1));
        }
        public static function addComponent(_arg1:UIComponent, _arg2:String, _arg3:Class=null, _arg4:String=null):UIComponent{
            var _local5:UIComponent = _arg1.addComponent(_arg2, _arg4, ((_arg3) || (UIComponent)));
            return (_local5);
        }
        public static function addClipComponent(_arg1:UIComponent, _arg2:String, _arg3:DisplayObject, _arg4:String=null):ClipComponent{
            var _local5:ClipComponent = (_arg1.addComponent(_arg2, _arg4, ClipComponent) as ClipComponent);
            _local5.clip = _arg3;
            return (_local5);
        }
        public static function addSimpleButton(_arg1:UIComponent, _arg2:String, _arg3:Function=null, _arg4:String=null):reprise.controls.SimpleButton{
            var _local5:reprise.controls.SimpleButton = reprise.controls.SimpleButton(_arg1.addComponent(_arg2, _arg4, reprise.controls.SimpleButton));
            ((_arg3) && (_local5.addEventListener(MouseEvent.CLICK, _arg3)));
            return (_local5);
        }
        public static function addLabelButton(_arg1:UIComponent, _arg2:String, _arg3:String=null, _arg4:Function=null, _arg5:String=null, _arg6:String=null):LabelButton{
            var _local7:LabelButton = LabelButton(_arg1.addComponent(_arg2, _arg5, LabelButton));
            _local7.setLabel(((_arg3) || ("")));
            ((_arg4) && (_local7.addEventListener(MouseEvent.CLICK, _arg4)));
            var _local8:Label = (_local7.getElementBySelector("Label") as Label);
            (_local7.getElementBySelector("Label") as Label).mouseEnabled = (_local8.mouseChildren = false);
            if (_arg6){
                _local8.addCSSClass(_arg6);
            };
            return (_local7);
        }
        public static function addRadioButton(_arg1:UIComponent, _arg2:String, _arg3:String=null, _arg4:String=null, _arg5:String=null):RadioButton{
            var _local6:RadioButton = RadioButton(_arg1.addComponent(_arg2, _arg5, RadioButton));
            _local6.setGroupName(_arg3);
            _local6.setLabel(((_arg4) || ("")));
            return (_local6);
        }
        public static function addLabel(_arg1:UIComponent, _arg2:String, _arg3:String=null, _arg4:String=null):Label{
            var _local5:Label;
            _local5 = Label(_arg1.addComponent(_arg2, _arg4, Label));
            _local5.setLabel(((_arg3) || ("")));
            _local5.mouseEnabled = (_local5.mouseChildren = false);
            return (_local5);
        }
        public static function addTextInput(_arg1:UIComponent, _arg2:String, _arg3:String=null, _arg4:String=null):TextInput{
            var _local5:TextInput = TextInput(_arg1.addComponent(_arg2, _arg4, TextInput));
            _local5.setLabel(((_arg3) || ("")));
            return (_local5);
        }
        public static function validateComponent(_arg1:IEventDispatcher, _arg2:Function):void{
            Events.handleOneTimeEvent(_arg1, _arg2, DisplayEvent.VALIDATION_COMPLETE);
        }
        private static function convertStandardToReprise(_arg1:String):String{
            var _local4:String;
            var _local5:RegExp;
            var _local2:String = _arg1;
            var _local3:Dictionary = new Dictionary();
            _local3["(<[ ]*size:(\\d+)[ ]*>)"] = "<span style=\"font-size:$2;\">";
            _local3["(</size[ ]*>)"] = "</span>";
            _local3["(<[ ]*color:(#?\\w+)[ ]*>)"] = "<span style=\"color:$2;\">";
            _local3["(</color[ ]*>)"] = "</span>";
            for (_local4 in _local3) {
                _local5 = new RegExp(_local4, "g");
                _local2 = _local2.replace(_local5, _local3[_local4]);
            };
            return (_local2);
        }

    }
}//package net.wooga.pets.utils 
